package dwarffortress.tools;

import dwarffortress.io.DFInflaterStream;

import java.util.zip.Deflater;
import java.util.zip.Inflater;
import java.util.zip.DataFormatException;
import java.io.*;

public class UnpackFile {
    public static void main(String[] args) throws IOException, DataFormatException {
        for (String file : args) {
            InputStream in_stream = new BufferedInputStream(new FileInputStream(file));
            DFInflaterStream in = new DFInflaterStream(in_stream);

            OutputStream out = new BufferedOutputStream(new FileOutputStream(file + ".raw"));
            int k = in.read();
            while (k >= 0) {
                out.write(k);
                k = in.read();
            }
            out.close();
        }
    }
}
